package everydayGrade.t6;

/**
 * @Author: Siantar
 * @Date: 2023-12-12-18:14
 * @Description: 1.0
 */
public class T0496 {
    public int[] nextGreaterElement(int[] nums1, int[] nums2) {
        for (int i = 0; i < nums1.length; i++) {
            int j = 0;
            while (nums2[j] != nums1[i]) j++;
            while (j < nums2.length && nums2[j] <= nums1[i]) j++;
            nums1[i] = j == nums2.length ? -1 : nums2[j];
        }
        return nums1;
    }
}
